package band.wukong.practice.java.demo.fileparser;

import band.wukong.practice.java.demo.fileparser.main.FileParser;
import band.wukong.practice.java.demo.fileparser.main.JavaFileFilter;

import java.io.File;

/**
 * Description: java源文件行数计数器
 * Author: jsun
 * Date: 2009-11-24 22:06:21
 */
public class JavaCodeCounter {
    public static void main(String[] args) {
        String dir = "E:\\somecode\\TestJava\\src\\com\\jsun\\demo\\fileparser\\testdir";
//        String dir = "E:\\somecode\\TestJava\\src\\com\\jsun\\demo\\fileparser\\main\\FileParser.java";
        JavaCodeCounter counter = new JavaCodeCounter();
        System.out.println("dir  : " + dir);
        System.out.println("count: " + counter.countWithoutBlankLineAndComment(dir));
    }

    public long countWithoutBlankLineAndComment(String dir) {
        return FileParser.countFileLines(new File(dir), false, new JavaFileFilter(), FileParser.REGEX_COMMENT_ALL);
    }
}
